local yeMiewu = fk.CreateSkill {
  name = "ye__miewu",
}

Fk:loadTranslationTable{
  ["ye__miewu"] = "灭吴",
  [":ye__miewu"] = "每回合限两次，你可以将一张牌当做任意一张基本牌或锦囊牌使用或打出；若如此做，你摸一张牌。",

  ["#ye__miewu"] = "灭吴：将一张牌当任意基本牌或锦囊牌使用或打出，然后摸一张牌",
}

yeMiewu:addEffect("viewas", {
  pattern = ".",
  prompt = "#ye__miewu",
  interaction = function(self, player)
    local all_names = Fk:getAllCardNames("btd")
    local names = player:getViewAsCardNames(yeMiewu.name, all_names)
    if #names == 0 then return end
    return UI.CardNameBox {choices = names, all_choices = all_names}
  end,
  handly_pile = true,
  filter_pattern = {
    min_num = 1,
    max_num = 1,
    pattern = ".",
  },
  view_as = function(self, player, cards)
    if #cards ~= 1 or not self.interaction.data then return end
    local card = Fk:cloneCard(self.interaction.data)
    card:addSubcards(cards)
    card.skillName = yeMiewu.name
    return card
  end,
  enabled_at_play = function(self, player)
    return player:usedSkillTimes(yeMiewu.name) < 2
  end,
  enabled_at_response = function(self, player, response)
    return player:usedSkillTimes(yeMiewu.name) < 2
  end,
})

local yeMiewu_spec = {
  mute = true,
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and table.contains(data.card.skillNames, yeMiewu.name) and not player.dead
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(1, yeMiewu.name)
  end,
}

yeMiewu:addEffect(fk.CardUseFinished, yeMiewu_spec)
yeMiewu:addEffect(fk.CardRespondFinished, yeMiewu_spec)

return yeMiewu
